package kr.co.shoppingmall.admin;

import java.util.HashMap;
import java.util.List;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

public class AdminDAOImpl extends SqlMapClientDaoSupport implements AdminDAO {

    @Override
    public void insertProduct(ProductDTO dto) {
	getSqlMapClientTemplate().insert("admin.insertProduct", dto);
    }

    @Override
    public List<ProductDTO> getProductList(HashMap map) {
	return getSqlMapClientTemplate().queryForList("admin.getProductList", map);
    }

    @Override
    public int getProductCount() {
	return (int) getSqlMapClientTemplate().queryForObject("admin.getProductCount");
    }

    @Override
    public ProductDTO getProduct(String prodCode) {
	ProductDTO dto = (ProductDTO) getSqlMapClientTemplate().queryForObject("admin.getProduct", prodCode);
	return dto;
    }

    @Override
    public void updateProduct(ProductDTO dto) {
	getSqlMapClientTemplate().update("admin.updateProduct", dto);
    }

    @Override
    public void deleteProduct(String prodCode) {
	getSqlMapClientTemplate().delete("admin.deleteProduct", prodCode);
    }
}
